#include <iostream>
using namespace std;

int enc (int m);

int main () 
{
    int m,n;
    cout<<"enter the code"<<endl;
    cin>>m;
    n=enc(m);
    cout<<n<<endl;

    cin>>m;
    return 0;
}

int enc( int m)
{
    int a,b,c,d,n;

    a=(int (m/1000)+5)%10;
    m=m-a*1000;
    b=(int (m/100)+5)%10;
    m=m-b*100;
    c=(int (m/10)+5)%10;
    m=m-c*10;
    d=(m%10+5)%10;

    n=d*1000+c*100+b*10+a;

    return n;
}